package com.ruoyi.paipan.controller;

import com.ruoyi.paipan.dto.RequestDto;
import com.ruoyi.paipan.dto.ZWNZRequestDto;
import com.ruoyi.paipan.service.PaiPanService;
import com.ruoyi.paipan.service.WNLService;
import com.ruoyi.paipan.service.ZWNZService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;

/**
 * @author tiemeng
 * * @date 2024/11/22
 */
@RestController
@CrossOrigin(origins = "*")
public class ApiController {
    @Autowired
    private PaiPanService paiPanService;

    @Autowired
    private ZWNZService zwnzService;

    @Autowired
    private WNLService wnlService;
    @GetMapping("/api2")
    public String api(HttpServletRequest request, RequestDto requestDto){
        Cookie[] cookies = request.getCookies();
        return paiPanService.getInfo(requestDto, cookies);
    }

    @GetMapping("ZW/ZWNZ1")
    @ResponseBody
    public LinkedHashMap<String,Object> ZWNZ1(ZWNZRequestDto requestDto){
        return zwnzService.getInfo(requestDto);
    }
//    @PostMapping("wnl")
    @RequestMapping("wnl")
    @ResponseBody
    public Object wnl(HttpServletRequest request, RequestDto requestDto){
        Cookie[] cookies = request.getCookies();
        return wnlService.getInfo(requestDto, cookies);
    }

}
